#pragma once
#include <iostream>
#include <string>
#include "util.hpp"
namespace ns_log
{
    using namespace ns_util;
    //日志等级
    enum
    {
        INFO,
        DEBUG,
        WARNING,
        ERROR,
        FATAL
    };

    inline std::ostream& Log(const std::string &level, const std::string &file_name, int line)
    {
        std::string message = "[";
        message += level;
        message += "]";

        message += "[";
        message += file_name;
        message += "]";

        message += "[";
        message += std::to_string(line);
        message += "]";

        message += "[";
        message += TimeUtil::GetTimeStamp();
        message += "]";

        std::cout << message;
        return std::cout;
    }

    #define LOG(level) Log(#level,__FILE__,__LINE__)  //宏里的整数前带#，可以字符串的方式传递
} // namespace ns_log
